package com.eddie.responsibilitychain.springmvc;

import org.springframework.web.servlet.DispatcherServlet;

/**
 * @author Eddie
 * @date 2022/08/08 16:09
 **/
public class ResponsibilityChain {
    public static void main(String[] args) {
//        DispatcherServlet dispatcherServlet = new DispatcherServlet();

        /**
         * protected void doDispatch(HttpServletRequest request, HttpServletResponse response) throws Exception {
         *           HandlerExecutionChain mappedHandler = null;
         *           mappedHandler = this.getHandler(processedRequest); 获取到了HandlerExecutionChain对象
         *           if (!mappedHandler.applyPreHandle(processedRequest, response)) {
         *                         return;
         *           }
         *           //mappedHandler.applyPostHandle方法内部获取拦截器并调用拦截器的
         *           //interceptor.postHandle(request, response, this.handler, mv);
         *           mappedHandler.applyPostHandle(processedRequest, response, mv);
         *
         *
         *           //说明：在mappedHandler.applyPreHandle方法中
         *           //还调用了triggerAfterCompletion方法，该方法中调用了
         *            HandlerInterceptor interceptor = (HandlerInterceptor)this.interceptorList.get(i);
         *
         *             try {
         *                 interceptor.afterCompletion(request, response, this.handler, ex);
         *             } catch (Throwable var7) {
         *                 logger.error("HandlerInterceptor.afterCompletion threw exception", var7);
         *             }
         * }
         */
    }
}
